package cate.game.role.farm.rank;

import cate.common.table.d.GDChampionRace;
import cate.common.table.d.GDOperation;
import cate.common.table.d.GDRank;
import cate.game.rank.IAdmireObj;
import cate.game.res.MixRes;
import cate.game.role.RoleDependent;
import easy.java.dev.note.NoteField;

public class UnrealAdmireObj extends RoleDependent implements IAdmireObj {
    @NoteField(value = "点赞次数")
    public int admireTimes;

    @NoteField(value = "天梯点赞次数")
    public int ladderAdmireTimes;

    @NoteField("跨服冠军赛点赞次数")
    public int championRaceAdmireTimes;

    @Override
    public void admire(int rank) {
        admireTimes++;
        MixRes reward = new MixRes(GDRank.ADMIRE_REWARD);
        reward.add(role, true, GDOperation.RANK_ADMIRE_REWARD);
        role.getGame().notice.dialogReward(role, reward);
    }

    public void admireLadder() {
        ladderAdmireTimes++;
        MixRes reward = new MixRes(GDRank.LADDER_ADMIRE_REWARD);
        reward.add(role, true, GDOperation.RANK_ADMIRE_REWARD);
        role.getGame().notice.dialogReward(role, reward);
    }

    public void admireChampionRace() {
        championRaceAdmireTimes++;
        MixRes reward = new MixRes(GDChampionRace.ADMIRE_REWARD_STR);
        reward.add(role, true, GDOperation.RANK_ADMIRE_REWARD);
        role.getGame().notice.dialogReward(role, reward);
    }

    public void admireWithoutReward() {
        admireTimes++;
    }

    @Override
    public int getAdmireTimes() {
        return admireTimes;
    }

    public int getAdmireTimes(int rankId) {
        switch (rankId) {
            case GDRank.Id.LADDER_RACE_RANK_ID:
                return ladderAdmireTimes;
            case GDRank.Id.CHAMPION_RACE_RANK_ID:
                return championRaceAdmireTimes;
            default:
                return admireTimes;
        }
    }

    @Override
    public void onDaySpan(boolean silence){
        this.admireTimes = 0;
        this.ladderAdmireTimes = 0;
        this.championRaceAdmireTimes = 0;
    }
}
